// 引入redux
import { applyMiddleware, combineReducers, createStore,compose  } from 'redux'
import TabbarReducer from './reducers/TabbarReducer'
import CityReducer from './reducers/CityReducer'
import CinemaListReducer from './reducers/CinemaListReducer'
// 导入ReduxThunk或redux-promise中间件，可以解决异步接收数据问题
// 同步不需要中间件
import ReduxThunk from 'redux-thunk'
import ReduxTPromise from 'redux-promise'
// 通过combineReducers把一个由多个不同 reducer 函数作为 value 的 object，合并成一个最终的 reducer 函数，然后就可以对这个 reducer 调用 createStore
const reducer = combineReducers({ TabbarReducer, CityReducer,CinemaListReducer})
// 使用ReduxThunk，导入applyMiddleware中间件使用
 const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; 

 const store = createStore(reducer,composeEnhancers(applyMiddleware(ReduxThunk,ReduxTPromise)))
// const store = createStore(reducer,
// store.dispatch
// store.subscribe
export default store